
import {defineStore} from 'pinia'
import {ref} from 'vue'
import {UserGetUserInfoSerive} from '@/api/user'
export const useUserStore = defineStore('big-user',()=>{
    const token = ref('')
    interface fomat{
        newToken:string
        token:string
    }
    const setToken = (newToken:string)=>{
         token.value = newToken
    }
    const removeToken = ()=>{
        token.value = ''
    }

    const userInfo = ref<any>({})
    const getUserinfo = async()=>{
      const res = await UserGetUserInfoSerive()
      userInfo.value = res.data.data  
         
    }
    return {
        token,
        setToken,
        removeToken,
        getUserinfo,
        userInfo,
    }
},{
    persist:true
}
 )